<html>
<head><meta charset="utf-8"><title>Found multiple rlibs for crate serde · clippy · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/index.html">clippy</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Found.20multiple.20rlibs.20for.20crate.20serde.html">Found multiple rlibs for crate serde</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="218234321"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Found%20multiple%20rlibs%20for%20crate%20serde/near/218234321" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eduardo Broto <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Found.20multiple.20rlibs.20for.20crate.20serde.html#218234321">(Nov 29 2020 at 22:40)</a>:</h4>
<p>I'm hitting the "thread 'compile_test' panicked at 'Found multiple rlibs for crate <code>serde</code>" bug when trying to test the in-tree version of clippy inside the rust-lang/rust repo (<code>x.py test src/tools/clippy</code>).</p>
<p>In the Clippy repo rebuilding after <code>cargo update</code> fixes the problem, but that's not working in this case. Anyone knows how to fix it?</p>
<p>Thanks!</p>



<a name="218236295"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Found%20multiple%20rlibs%20for%20crate%20serde/near/218236295" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matthiaskrgr <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Found.20multiple.20rlibs.20for.20crate.20serde.html#218236295">(Nov 29 2020 at 23:34)</a>:</h4>
<p>does <code>cargo clean</code> fix that?</p>



<a name="218236312"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Found%20multiple%20rlibs%20for%20crate%20serde/near/218236312" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matthiaskrgr <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Found.20multiple.20rlibs.20for.20crate.20serde.html#218236312">(Nov 29 2020 at 23:35)</a>:</h4>
<p>another idea: <em>perhaps</em> you have  version 1 of a dep pulled in via <code>clippy</code> and version 2 of that dep pulled in via <code>clippy-lints</code> and ther's a conflict...?  (<code>cargo update</code>ing clippy-lints might help, not sure...)</p>



<a name="218236363"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Found%20multiple%20rlibs%20for%20crate%20serde/near/218236363" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matthiaskrgr <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Found.20multiple.20rlibs.20for.20crate.20serde.html#218236363">(Nov 29 2020 at 23:37)</a>:</h4>
<p>I think I hit something similar when testing the internal-lints patch, as I ran <code>cargo test</code> two times and changed features without doing a clean build and cleaning the <code>target</code> dir fixed it... <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="218236522"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Found%20multiple%20rlibs%20for%20crate%20serde/near/218236522" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Found.20multiple.20rlibs.20for.20crate.20serde.html#218236522">(Nov 29 2020 at 23:40)</a>:</h4>
<p>this is probably because you have serde once through clippy's dependencies and once through the sysroot</p>



<a name="218236530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Found%20multiple%20rlibs%20for%20crate%20serde/near/218236530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Found.20multiple.20rlibs.20for.20crate.20serde.html#218236530">(Nov 29 2020 at 23:41)</a>:</h4>
<p>no idea how to fix it, but <a href="https://github.com/rust-lang/rustc-dev-guide/pull/976/">https://github.com/rust-lang/rustc-dev-guide/pull/976/</a> might help you debug it at least</p>



<a name="218344341"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Found%20multiple%20rlibs%20for%20crate%20serde/near/218344341" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eduardo Broto <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Found.20multiple.20rlibs.20for.20crate.20serde.html#218344341">(Nov 30 2020 at 20:52)</a>:</h4>
<p>Thanks for the ideas! I will try again today</p>



<a name="218344405"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Found%20multiple%20rlibs%20for%20crate%20serde/near/218344405" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eduardo Broto <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Found.20multiple.20rlibs.20for.20crate.20serde.html#218344405">(Nov 30 2020 at 20:53)</a>:</h4>
<p>(deleted)</p>



<a name="218348576"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Found%20multiple%20rlibs%20for%20crate%20serde/near/218348576" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eduardo Broto <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Found.20multiple.20rlibs.20for.20crate.20serde.html#218348576">(Nov 30 2020 at 21:28)</a>:</h4>
<p>So, removing the build directory for <code>stage1-tools</code> fixed the problem, but now I'm getting another error, now for a test.</p>
<div class="codehilite"><pre><span></span><code>error[E0464]: multiple matching crates for `serde_derive`
  --&gt; $DIR/used_underscore_binding_macro.rs:4:1
   |
LL | extern crate serde_derive;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: candidates:
           crate `serde_derive`: /home/ebroto/src/ebroto-rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libserde_derive-0639c3c6ce1b8ef0.so
           crate `serde_derive`: /home/ebroto/src/ebroto-rust/build/x86_64-unknown-linux-gnu/stage1-tools/release/deps/libserde_derive-baf5004a5b56a3b6.so

error: aborting due to previous error
</code></pre></div>
<p>From <a href="https://github.com/rust-lang/rust/pull/78399#issuecomment-726672743">this comment</a>, I think I understand that this could already be happening when rebuilding Clippy in-tree (which is what I did). It's not clear to me though what happens when this works, why wouldn't you get multiple copies of the lib? </p>
<p>This is the same error of <a href="#narrow/stream/257328-clippy/topic/multiple.20matching.20crates/near/216590414">this other topic</a>, although IIUC it has a different cause.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>